Hi all, i have a problem, i want to write all links from database into a skip list, but i think the list is to small
Project p
Module m
Object o
Link l
int ip = 0
int im = 0
int io = 0
int il = 0
int ill = 0
string tOut = ""
string sOut = ""
string tIn = ""
string sIn = ""
Skip sk = createString()
for p in database do
{
for m in p do
{
im++
for o in entire m do
{
io++
for l in o -> "*" do
{
il++
tOut = target(l)
sOut = source(l)
string ss = tOut " " sOut
put(sk, ss, ss)
}
for l in o <- "*" do
{
ill++
tIn = target(l)
sIn = source(l)
string sss = tIn " " sIn
put(sk, sss, sss)
}
}
}
ip++
}
print ip
print im
print io
print il
print ill
string lkey = ""
for lkey in sk do
{
print lkey "\n"
}
Output:
8 AND in sk list are sometime 41, or 42, or 43 entries, not more,, it should be 7604 *2? Or am i wrong?
Thanks
meinhana - Thu Aug 18 03:47:40 EDT 2016 |
Re: Skip list to small One problem may be your "for module in project loop" From the DXL Ref Manual:
If you want all modules in the project, one method is as follows:
Item i
Project p = current
for i in p do
{
if (isDeleted(i)) continue
if (type(i) != "Formal") continue
Module m = read(fullName(i), false)
if (null(m)) continue
// do your module processing here
close(m)
}
Additionally, for inlinks, you need to use for LinkRef in o <- "*" do otherwise, you will only see inlinks from modules that are currently open |
Re: Skip list to small Antonio__Norkus - Thu Aug 18 05:19:49 EDT 2016 One problem may be your "for module in project loop" From the DXL Ref Manual:
If you want all modules in the project, one method is as follows:
Item i
Project p = current
for i in p do
{
if (isDeleted(i)) continue
if (type(i) != "Formal") continue
Module m = read(fullName(i), false)
if (null(m)) continue
// do your module processing here
close(m)
}
Additionally, for inlinks, you need to use for LinkRef in o <- "*" do otherwise, you will only see inlinks from modules that are currently open Still 43 entries... |
Re: Skip list to small
Also, you are counting individual links. The skip list removes duplicate entries, so your skip list contains the set of source/target pairings in your project |
Re: Skip list to small Antonio__Norkus - Thu Aug 18 05:37:01 EDT 2016
Also, you are counting individual links. The skip list removes duplicate entries, so your skip list contains the set of source/target pairings in your project The first parameter of the skiplist is an unique index which helps to sort the list itself. For example:
Skip skpNumber = create();
string sHelp; put (skpNumer, 2, "another two");
for sHelp in skpNumber do { will print
one So you have a Link l and you will place the into the list with no sorting, you can start by: Skip sk = create(); // instead of createString() and inside the loop
il++; |
Re: Skip list to small Antonio you are right! Thank you all for your help And thank you too, Wolfgang ! Now i understand it :) |